package com.neusoft.eenie.signdemo.ui;

import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by Eenie on 2016/3/25.
 */
public class BaseActivity extends AppCompatActivity {




    AlertDialog dialog;
    AlertDialog.Builder builder;




    public void showDialog(String msg) {
        missDialog();

        if (builder == null) {
            builder = new AlertDialog.Builder(this);
        }
        builder.setCancelable(false);
        builder.setTitle("提示：");
        builder.setMessage(msg);
        dialog = builder.create();
        dialog.show();
    }

    public void showDialog(String msg, boolean cancel) {
        missDialog();

        if (builder == null) {
            builder = new AlertDialog.Builder(this);
        }
        builder.setCancelable(cancel);
        builder.setTitle("提示：");
        builder.setMessage(msg);
        dialog = builder.create();
        dialog.show();
    }


    public void missDialog() {
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    }

}
